extends WeaponBase

@onready var intervalTimer = $Interval
@onready var born01 = $Born01
@onready var born02 = $Born02
@onready var born03 = $Born03
@onready var born04 = $Born04
@onready var born05 = $Born05
var stated = false


func _ready():
	intervalTimer.timeout.connect(shoot)
	

func _exit_tree():
	intervalTimer.timeout.disconnect(shoot)


func startShoot():
	intervalTimer.start()
	

func endShoot():
	intervalTimer.stop()


func shoot():
	var bulletInst01:Bullet01 = Global.createSceneInst("Bullet01")
	var bulletInst02:Bullet01 = Global.createSceneInst("Bullet01")
	var bulletInst03:Bullet01 = Global.createSceneInst("Bullet01")
	var bulletInst04:Bullet01 = Global.createSceneInst("Bullet01")
	var bulletInst05:Bullet01 = Global.createSceneInst("Bullet01")
	
	get_tree().current_scene.add_child(bulletInst01)
	get_tree().current_scene.add_child(bulletInst02)
	get_tree().current_scene.add_child(bulletInst03)
	get_tree().current_scene.add_child(bulletInst04)
	get_tree().current_scene.add_child(bulletInst05)
	
	bulletInst01.setPos(born01.global_position)
	bulletInst02.setPos(born02.global_position)
	bulletInst03.setPos(born03.global_position)
	bulletInst04.setPos(born04.global_position)
	bulletInst05.setPos(born05.global_position)
	
